﻿using System.Net;
using System.Net.Http;
using System.Web.Http;

using Sustainalytics.ESGRatings.BusinessLogic.Computing;

namespace Sustainalytics.ESGComputing.Service.Controllers
{
    [RoutePrefix("api/v1/health")]
    public class EsgComputationHealthController : ApiController
    {
        private readonly ComputationEngine _engine;

        public EsgComputationHealthController(ComputationEngine engine)
        {
            _engine = engine;
        }

        [Route("status")]
        public HttpResponseMessage Get()
        {
            return Request.CreateResponse(HttpStatusCode.OK);
        }

        [Route("clean")]
        public HttpResponseMessage Post()
        {
            var deletedGuids = _engine.DeleteAll();

            return Request.CreateResponse(HttpStatusCode.OK, deletedGuids);
        }
    }
}